package com.dp.vo;

import java.io.Serializable;
import java.util.Date;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;


@Entity
@Table(name = "t_ebook_section")
//@NamedQueries({@NamedQuery(name = "TEbookSection.findAll", query = "SELECT t FROM TEbookSection t"), @NamedQuery(name = "TEbookSection.findBySectionid", query = "SELECT t FROM TEbookSection t WHERE t.sectionid = :sectionid")})
public class TEbookSection  implements Serializable{
	private static final long serialVersionUID = 1L;
	@Id
	@Basic(optional = false)
	@Column(name = "sectionid")
	private Integer sectionid;                    //章节id
	/*@Column(name = "t_e_contentid")     
	private String te_contentid;                 //所属ebook内容id
*/	@Column(name = "sectionname")     
	private String sectionname;                  //章节名称
	@Column(name = "sectioncontent")     
	private String sectioncontent;               //章节内容
	@Column(name = "htmlcontent")     
	private String htmlcontent;                  //章节html内容
	@Column(name = "adduser")     
	private String adduser;              
	@Column(name = "updatetime")   
	@Temporal(TemporalType.TIMESTAMP)
	private Date updatetime;                
	@Column(name = "sectionorder")     
	private Integer sectionorder;                //章节顺序
	@Column(name = "isfree")     
	private Integer isfree;                      //是否是免费试读
	@Column(name = "islink")     
	private Integer islink;                      //是否是章节标题
	@Column(name = "sectionstatus")     
	private String sectionstatus;               //章节审核状态
	@Column(name = "auditer")     
	private String auditer;                      //审核人
	@Column(name = "cause")     
	private String cause;                        //未通过原因
	@Column(name = "filepath")     
	private String filepath;                        //章节文件路径
	
	@JoinColumn(name = "t_e_contentid", referencedColumnName = "contentid")   
	@ManyToOne
    private TEbookContent tebookContent;		  //所属ebook内容
	@OneToMany(fetch = FetchType.EAGER,mappedBy = "tebookSection")
    private Set<TEbookResource> tbookResources;   //内容章节下资源Set
	
	public TEbookSection(){
	}
    public TEbookSection(Integer sectionid){
		this.sectionid=sectionid;
	}
	public Integer getSectionid() {
		return sectionid;
	}
	public void setSectionid(Integer sectionid) {
		this.sectionid = sectionid;
	}
	/*public String getTe_contentid() {
		return te_contentid;
	}
	public void setTe_contentid(String te_contentid) {
		this.te_contentid = te_contentid;
	}*/
	public String getSectionname() {
		return sectionname;
	}
	public void setSectionname(String sectionname) {
		this.sectionname = sectionname;
	}
	public String getSectioncontent() {
		return sectioncontent;
	}
	public void setSectioncontent(String sectioncontent) {
		this.sectioncontent = sectioncontent;
	}
	public String getHtmlcontent() {
		return htmlcontent;
	}
	public void setHtmlcontent(String htmlcontent) {
		this.htmlcontent = htmlcontent;
	}
	public String getAdduser() {
		return adduser;
	}
	public void setAdduser(String adduser) {
		this.adduser = adduser;
	}
	public Date getUpdatetime() {
		return updatetime;
	}
	public void setUpdatetime(Date updatetime) {
		this.updatetime = updatetime;
	}
	public Integer getSectionorder() {
		return sectionorder;
	}
	public void setSectionorder(Integer sectionorder) {
		this.sectionorder = sectionorder;
	}
	public Integer getIsfree() {
		return isfree;
	}
	public void setIsfree(Integer isfree) {
		this.isfree = isfree;
	}
	public Integer getIslink() {
		return islink;
	}
	public void setIslink(Integer islink) {
		this.islink = islink;
	}
	public String getSectionstatus() {
		return sectionstatus;
	}
	public void setSectionstatus(String sectionstatus) {
		this.sectionstatus = sectionstatus;
	}
	public String getAuditer() {
		return auditer;
	}
	public void setAuditer(String auditer) {
		this.auditer = auditer;
	}
	public String getCause() {
		return cause;
	}
	public void setCause(String cause) {
		this.cause = cause;
	}
	public String getFilepath() {
		return filepath;
	}
	public void setFilepath(String filepath) {
		this.filepath = filepath;
	}
	public TEbookContent getTebookContent() {
		return tebookContent;
	}
	public void setTebookContent(TEbookContent tebookContent) {
		this.tebookContent = tebookContent;
	}
	public Set<TEbookResource> getTbookResources() {
		return tbookResources;
	}
	public void setTbookResources(Set<TEbookResource> tbookResources) {
		this.tbookResources = tbookResources;
	}
	
	@Override
	public int hashCode() {
	        int hash = 0;
	        hash += (sectionid != null ? sectionid.hashCode() : 0);
	        return hash;
	}

    @Override
	public boolean equals(Object object) {
	    if (!(object instanceof TEbookSection)) {
	          return false;
	     }
	    TEbookSection other = (TEbookSection) object;
	     if ((this.sectionid == null && other.sectionid != null) || (this.sectionid != null && !this.sectionid.equals(other.sectionid))) {
	         return false;
	     }
	     return true;
	}
	    
	@Override
    public String toString() {
        return "com.dp.vo.TEbookSection[sectionid=" + sectionid + "]";
    }
	
}
